1 package jrre.instructionset.math;
2
3 import jrre.*;
4 import jrre.types.*;
5
6 public class IAdd extends jrre.instructionset.Instruction {
7
8 public IAdd(){
9
10 name = "IAdd";
11 description = "foo foo moo poo";
12 length = 0;
13 }
14
15 /***
16 * Executes the <strong><code>IAdd</code></strong> instruction.
17 *
18 */
19 public void execute(){
20
21 Type leftType = Stack.popOperand();
22 Type rightType = Stack.popOperand();
23
24 //System.out.println("leftType: "+leftType);
25 //System.out.println("rightType: "+rightType);
26
27 int leftSide = ((PrimitiveType)leftType).getValue();
28 int rightSide = ((PrimitiveType)rightType).getValue();
29
30 Stack.pushOperand(new PrimitiveType(leftSide+rightSide));
31
32 }
33
34 public String toString(){
35 StringBuffer toReturn = new StringBuffer();
36 toReturn.append("iadd");
37 return toReturn.toString();
38 }
39 }
This page was automatically generated by Maven